<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>myorder</title>
	<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
	<link rel="stylesheet" type="text/css" href="./css/my.css" />
</head>

<body>
	<div class="order_bg">
		<div class="nav_top ui-row teamlist bottom_bj">
			<ul class="search_list" id="div_goods_list">
				<li class="active" data-source-type="tb">淘宝</li>
				<li class="" data-source-type="jd">京东</li>
				<li class="" data-source-type="pdd">拼多多</li>
				<li class="" data-source-type="sn">苏宁</li>
				<li class="" data-source-type="vip">唯品会</li>
				<li class="" data-source-type="mg">蘑菇街</li>
			</ul>
		</div>
		<div class="nav_top ui-row orderlist_style font-bjc">
			<ul>
				<li class="active quan">
					全部
				</li>
				<li>
					已付款
				</li>
				<li>
					已收货
				</li>
				<li>
					已结算
				</li>
				<li>
					已失效
				</li>
			</ul>
		</div>
		<div class="order_box" style="margin-top:0px;">
			<div class="order-list-box">
				<div class="examined-order team-order active" id="div_order_list">
				</div>
			</div>
		</div>
	</div>
	<!--加载loading-->
	<div class="index_loading">
		<img src="./image/index_loading.gif" />
		<span>加载中,请稍后...</span>
	</div>
	<!--暂无数据-->
	<div class="temporarily_data" style="display:none;">
		<img src="./image/no_date.png" />
		<span>暂无数据</span>
	</div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/config.js"></script>
<script type="text/javascript" src="../../script/zepto.min.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/doT.min.js"></script>
<script id="orderlist-tmpl" type="text/x-dot-template">
	{{ for(var i=0, len=it.length; i
	<len; i++) {}} <div class="examined-order-box">
		<div class="examined-order-item">
			<div class="order-num">
				订单号：{{=it[i].trade_parent_id}}<br />团队：{{=it[i].usermobile}}
			</div>
		</div>
		<div class="order-body">
			<div class="shop-infor">
				<div class="shop-infor-left fl" style="margin-top:12px;">
					<span class="{{=it[i].source_type}}_font_style" style="margin-right:4px;">{{? it[i].source_type=='tb'}}淘宝{{?? it[i].source_type=='jd'}}京东{{??it[i].source_type=='pdd'}}拼多多{{??it[i].source_type=='vip'}}唯品会{{??it[i].source_type=='sn'}}苏宁{{?}}					<text>
							订单详情 &nbsp;
						</text>
				</div>
				<div class="shop-infor-right fr">
					{{=it[i].pay_time}}
				</div>
			</div>
			<div class="goods-infor" style="padding-bottom: 18px;">
				<div class="goods-infor-left fl">
					<img src="./image/icon_{{=it[i].source_type}}.png" />
				</div>
				<div class="order_box_fl">
					<div class="goods-infor-center fl">
						<div class="goodsname">
							{{=it[i].item_title}}
						</div>
					</div>
					<div class="goods-infor-center fl line_font-style">
						<div class="goodsname color-wuxiao">
							{{? it[i].tk_status=='13'}} 已失效 {{?? it[i].tk_status=='12'}} 已付款 {{?? it[i].tk_status=='3' && it[i].isjiesuan==0}} 已收货 {{?? it[i].tk_status=='3' && it[i].isjiesuan==1}}已结算{{?}}
						</div>
					</div>
				</div>
				<div class="goods-infor-right fr color-jg-ls">
					<text>
							￥{{=(it[i].alipay_total_price*1).toFixed(2)}}
						</text>
					<text>
							X{{=it[i].item_num}}
						</text>
				</div>
				<div class="goods_commission" style="bottom:12.5px;">
					<text>
	        预估佣金:￥{{=(it[i].pub_share_pre_fee*it[i].yjrate *0.01 * it[i].xjyjrate *0.01).toFixed(2)}}
				  </text>
				</div>
			</div>
		</div>
		</div>
		{{ }}}
</script>
<script type="text/javascript">
	var pageParam = {
		status_code: 0,
		keyword: '',
		isloaded: true,
		pageindex: 1,
		source_type: 'tb'
	};
	apiready = function() {
		getMyOrder();
		doChagevalidcode();
		doChangeSource_type();
		doScroll();
	}
	$(document).ready(function() {

	});

	function getMyOrder() {
		if (!pageParam.isloaded) {
			return;
		}
		if (pageParam.status_code == 0) {
			pageParam.status_code = '';
		} else if (pageParam.status_code == 1) {
			pageParam.status_code = 12;
		} else if (pageParam.status_code == 2) {
			pageParam.status_code = 3;
		} else if (pageParam.status_code == 3) {
			pageParam.status_code = 3;
			var isjiesuan = 1;
		} else if (pageParam.status_code == 4) {
			pageParam.status_code = 13;
		}
		pageParam.isloaded = false;
		pageParam.orderid = pageParam.keyword;
		$('.temporarily_data').hide();
		$(".index_loading").show();
		postDataLogin('getTeamOrder', {
			source_type: pageParam.source_type,
			tk_status: pageParam.status_code,
			page: pageParam.pageindex,
			orderid: pageParam.orderid,
			isjiesuan: isjiesuan || 0
		}, function(res) {
			$(".index_loading").hide();
			if (res.code == 1) {
				console.log(JSON.stringify(res));
				var list = doT.template($('#orderlist-tmpl').text());
				$("#div_order_list").append(list(res.data));
				pageParam.isloaded = true;
			} else {
				if (pageParam.pageindex == 1) {
					$('.temporarily_data').show();
				} else {
					pageParam.isloaded = false;
					$(".index_loading img").hide();
					$(".index_loading span").html("<div style='color:#dddddd;padding-left:30px'>—这是我的底线—</div>");
					$(".index_loading").show();
				}
			}
		});
	}

	function doChangeSource_type() {
		$('.teamlist ul li').unbind('click').click(function() {
			pageParam.pageindex = 1;
			pageParam.isloaded = true;
			$(".examined-order").empty();
			$(this).addClass('active').siblings().removeClass('active');
			$('.orderlist_style li.quan').addClass('active').siblings().removeClass('active');
			pageParam.source_type = $('.search_list li.active').attr('data-source-type');
			pageParam.status_code = 0;
			$('.top_search_txt').val('');
			pageParam.keyword = '';
			$('.temporarily_data').hide();
			getMyOrder();
		})
	}
	function doScroll() {
		getMoreGoods(function() {
			if (pageParam.isloaded) {
				pageParam.pageindex = parseInt(pageParam.pageindex) + 1;
				getMyOrder();
			}
		});
	}

	function doChagevalidcode() {
		$('.orderlist_style li').unbind('click').click(function() {
			$('.temporarily_data').hide();
			pageParam.pageindex = 1;
			pageParam.isloaded = true;
			$(".examined-order").empty();
			$(this).addClass('active').siblings().removeClass('active');
			pageParam.status_code = $(this).index();
			$(".index_loading").hide();
			getMyOrder();
		})
	}
</script>

</html>
